# 1、给定一个列表： [465,8231,8123485,215,612318,12534,561231561,5631,584,2318564,584,5634,561326,4156,1]
# 1.1
arr = [465, 8231, 8123485, 215, 612318, 12534, 561231561, 5631, 584, 2318564, 584, 5634, 561326, 4156, 1]
print(arr[5])
# 1.2
for item in arr:
    if (item == 561231561):
        print("今天你猜对了哦")
# 1.3
arr1 = []
for item in arr:
    if (item % 2 == 0):
        arr1.append(item)
print(arr1)

# 2.定义集合，使用for遍历访问元素
set1 = set()
for i in range(10):
    set1.add(i)
print(set1)

# 3.定义字符串，使用for遍历访问元素
str1 = "fengdingyu"
for i in str1:
    print(i,end='')
print()

# 4、定义字典，使用for遍历访问元素
dict1 = {"a": "2", "b": "3", "c": "5"}
for key, value in dict1.items():
    print(key, value)

# 5.定义列表，使用for遍历访问元素
list1 = []
for i in range(10):
    list1.append(i)
print(list1)

# 6、遍历：{465,84564,5641,21564,1891563,481564,651,"刘闯","王李","李四","王三"}
set2 = {465, 84564, 5641, 21564, 1891563, 481564, 651, "刘闯", "王李", "李四", "王三"}
for i in set2:
    print(i, end='')
print()

# 6.1、使用for循环遍历上面的集合，如果输出到了刘闯，则循环结束
for i in set2:
    if i == '刘闯':
        print("————————————刘闯真傻逼————————————")
        break
    print(i,end='')
print()

